﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/OneColumn.Master" AutoEventWireup="true"
    CodeBehind="Latest.aspx.cs" Inherits="SharingCenter.Web.User.Events.Latest" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
最新活动
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
    .eventitem td{height:30px;}
    .eventitem .useravatar{border:1px solid silver!important;padding:1px;}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <myuc:GenericTabs ID="GenericTabs1" runat="server" SelectedItem="latest" Section="MyEvent" />
    
    <h2 class="bb">
    <span class="nss ns-calendar"></span>
        <span class="iconlabel">最新活动</span></h2>
    <asp:ListView ID="ListView1" runat="server" DataSourceID="LinqDataSource1" DataKeyNames="EventId">
        <ItemSeparatorTemplate>
            <tr>
                <td colspan="10">
                    <div class="hr1"></div>
                </td>
            </tr>
        </ItemSeparatorTemplate>
        <ItemTemplate>
            <tr class="eventitem">
                <td>
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/Content/images/icons/star_on.png" AlternateText="精" ToolTip="精" Visible='<%#Eval("IsRecommended") %>' />
                    <asp:Image runat="server" ImageUrl="~/Content/images/icons/fire_on.png" AlternateText="热" ToolTip="热" Visible='<%#Eval("IsHot") %>' />

                    <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("Title") %>' NavigateUrl='<%#Eval("EventId", "~/Mod/Events/?id={0}") %>' />
                    <asp:Label ID="CategoryLabel" CssClass="litetext" runat="server" Text='<%# Eval("Category", "({0})") %>' />
                </td>
                <td>
                    <asp:Label ID="StartDateLabel" runat="server" Text='<%# Eval("StartDate", "{0:M月d日 HH:mm}") %>' />
                </td>
                <td>
                    <cc:AvatarImage CssClass="useravatar" AvatarType="Tiny" AlternateText="" Width="16" UserId='<%#Eval("CreatorUserId") %>' runat="server" />
                    <cc:NickNameLink runat="server" UserId='<%#Eval("CreatorUserId") %>' />
                </td>
                <td>
                    <asp:Label ID="Sc_EventRequestsLabel" runat="server" Text='<%# Eval("Sc_EventParticipants.Count")+"/"+((int)Eval("MaxParticipants")>0?Eval("MaxParticipants"):"无限制") %>' />
                </td>
            </tr>
        </ItemTemplate>
        <EmptyDataTemplate>
            <myuc:MessageBox runat="server" MessageType="Generic" Text="目前没有任何活动。" />
        </EmptyDataTemplate>
        <LayoutTemplate>
            <table id="itemPlaceholderContainer" runat="server" border="0" class="tb-full">
                <tr>
                    <th>
                        活动名称
                    </th>
                    <th >
                        开始日期
                    </th>
                    <th>
                        发起人
                    </th>
                    <th>
                        参与/上限
                    </th>
                </tr>
                <tr id="itemPlaceholder" runat="server">
                </tr>
            </table>
            <div class="actionarea textfar">
                <asp:DataPager ID="DataPager1" runat="server" PageSize="20">
                    <Fields>
                        <asp:NextPreviousPagerField ButtonType="Link" FirstPageText="首页" ButtonCssClass="pager-f1 "
                            ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
                        <asp:NumericPagerField ButtonType="Link" NumericButtonCssClass="pager-n1 " CurrentPageLabelCssClass="pager-c" />
                        <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" ShowNextPageButton="False"
                            ButtonCssClass="pager-l1 " ShowPreviousPageButton="False" LastPageText="末页" />
                    </Fields>
                </asp:DataPager>
            </div>
        </LayoutTemplate>
    </asp:ListView>
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="SharingCenter.Web.Classes.scDataContext"
        OrderBy="IsRecommended desc, StartDate"
        TableName="Sc_Events" 
        Where="StartDate &gt;= @StartDate &amp;&amp; EventSource != @EventSource">
        <WhereParameters>
            <asp:Parameter Name="StartDate" Type="DateTime" />
            <asp:Parameter Name="EventSource" />
        </WhereParameters>
    </asp:LinqDataSource>
</asp:Content>
